Read an entire text fileΒΆ

Read an entire text file.
def file_read(fname):
    txt = open(fname)
    print(txt.read())

file_read('test.txt')

Output:

Welcome to w3resource.com.
Append this text. Append this text. Append this text.
Append this text.